<template>
  <div class="goods-item" @click="itemClick(item.item_id)">
    <img :src="item.image" alt="">
    <div class="goods-info">
      <p>{{item.title}}</p>
      <span class="price">￥{{item.price}}</span>
      <span class="collect"><i class="el-icon-star-off"></i>{{item.cfav}}</span>
    </div>
  </div>
</template>

<script>
export default {
  name:"GoodsListItem",
  props: {
    item:{
      type:Object,
      default(){
        return {}
      }
    }
  },
  methods: {
    itemClick(id){
      // console.log("跳转到详情页")
      this.$router.push('/detail/' + id)
    }
  },
  // computed: {
  //   showImage() {
  //     return this.item.show.img || 
  //   }
  // }
}
</script>

<style scoped>

  .goods-item{
    width: 49%;
    text-align: center;
    font-size: 5px;
    padding-bottom: 12px;
  }

  .goods-item img{
    width: 100%;
    border-radius: 5px;
    height: 275px;
  }

  .goods-item p{
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    margin-bottom: 3px;
  }

  .price{
    color: var(--color-high-text);
    margin-right: 20px;
  }

</style>